package org.example.echo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * Application
 *
 * @author zhengchalei
 * @date 2021/09/26
 */
@SpringBootApplication
public class EchoApplication {
    public static void main(String[] args) {
        SpringApplication.run(EchoApplication.class, args);
    }

    @RestController
    static class Echo {
        @RequestMapping("/echo")
        public Mono<String> echo(@RequestParam(defaultValue = "xiaoshitou", required = false) String msg) {
            return Mono.just("hello " + msg);
        }
    }
}
